Ext.define('Era.view.IconScreen',{
    extend: 'Ext.panel.Panel',
    alias: 'widget.iconscreen',
    width: 400,
    autoHeight: true,

    layout: {
        type: 'table',
        columns: 6
    },
    
    value: 'data/icons/default.png',

    initComponent: function() { 
        this.items = [];
        
        for (i=0;i<icons.length;i++) {
            var ic = Ext.create('Era.view.IconField',{
                src: icons[i],
                mode: 'select',
                value: icons[i],
                
                style: {
                    margin: '10px'
                },
                
                listeners: {
                    click: function() {
                        
                        try {
                            var field = Era.controller.Main.menuWindow.down('eventscreen').down('iconfield');
                            field.setValue(this.getValue());
                            field.fireEvent('Render',field);
                        } catch(e) {
                            
                        } 

                        Era.controller.Main.hideIconWindow();
                        
                    }
                } 
            });
            
            this.items.push(ic);
        }
       
        this.callParent(this);
    }
    
    
});
